package com.clkj.goldpartner.dao;

import com.clkj.goldpartner.pojo.Member;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

/**
 * @author 杨行
 * @date 2021/2/28 16:41
 */
@Repository
public interface MemberMapper extends Mapper<Member> {

    /**
     * 获取人员管理列表
     *
     * @param shop_id
     * @param member_name
     * @param member_sex
     * @return List<Member>
     */
    @Select("select * from t_cl_member where shop_id = #{shop_id} and member_status = '0' and member_name like '%${member_name}%' and member_sex like '%${member_sex}%' ")
    List<Member> getMemberList(Integer shop_id, String member_name, String member_sex);


    /**
     * 获取相关分类人员列表
     *
     * @param shop_id
     * @param member_type
     * @return List<Member>
     */
    @Select("select * from t_cl_member where shop_id = #{shop_id} and member_type in (${member_type})")
    List<Member> getMemberListByType(Integer shop_id, String member_type);

    /**
     * 删除人员
     *
     * @param ids
     */
    @Update("update t_cl_member set member_status = '1' where member_id in (${ids})")
    void deleteMember(@Param("ids") String ids);

}
